/* 
 * @date: 2023-12-13 13:13:18
 * description: 把url参数转换成对象
 * @param {*}
 * @return {*} {}
 */
export function urlParse(URL) {
    var url = URL ? URL : window.location.href;
    var obj = {};
    var reg = /[?&][^?&]+=[^?&]+/g;
    var arr = url.match(reg);
    if (arr) {
        arr.forEach(function (item) {
            var tempArr = item.substring(1).split('=');//substring(1)是为了去掉?号
            var key = decodeURIComponent(tempArr[0]);//decodeURIComponent解码
            var val = decodeURIComponent(tempArr[1]);//decodeURIComponent解码
            obj[key] = val;
        });
    }
    return obj;
}

/* 
 * @date: 2023-12-22 13:22:47
 * description 密码校验不能长度小于6位且必须包含数字和字母
 * @param {*}
 * @return {*} {}
 */
export function checkPwd(pwd) {
    let reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
    return reg.test(pwd);
}

/* 
 * @date: 2023-12-26 10:20:42
 * description 验证手机号
 * @param {*}
 * @return {*} {}
 */

export function checkPhone(phone) {
    let reg = /^1[3456789]\d{9}$/;
    return reg.test(phone);
}
